import { createRouter, createWebHistory } from 'vue-router'
import Layouts from '../layouts/index.vue';
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      component: Layouts,
      redirect: '/BigScreen',
      children: [
        {
          path: '/PersonalCenter',
          name: 'PersonalCenter',
          meta: {
            title: '个人中心',
            affix: true,
            noCache: true,
          },
          component: () => import('../views/PersonalCenter/index.vue')
        },
        {
          path: "/BigScreen",
          name: 'BigScreen',
          component: () => import('../views/BigScreen/index.vue'),
          meta: {
            title: '首页',
            affix: true,
            noCache: true,
          },
        },
        {
          path: "/map",
          name: 'map',
          component: () => import('../views/mapTest/index.vue'),
          meta: {
            title: '地图',
            affix: true,
            noCache: true,
          },
        },
        {
          path: "/CommunityHealthcare",
          name: 'CommunityHealthcare',
          component: () => import('../views/CommunityHealthcare/index.vue'),
          meta: {
            title: '健康医疗',
            affix: true,
            noCache: true,
          },
          redirect: "/CommunityHealthcare/default",
          children: [
            {
              path: "/CommunityHealthcare/default",
              name: 'default',
              component: () => import('../views/CommunityHealthcare/default/index.vue'),
              meta: {
                title: '健康医疗/大厅',
                affix: true,
                noCache: true,
              },
            },
            {
              path: "/CommunityHealthcare/MakeAppointment",
              name: 'MakeAppointment',
              component: () => import('../views/CommunityHealthcare/MakeAppointment/index.vue'),
              meta: {
                title: '健康医疗/预约挂号',
                affix: true,
                noCache: true,
              },
              // 
            },
            {
              path: "/CommunityHealthcare/ChatComponent",
              name: 'ChatComponent',
              component: () => import('@/views/CommunityHealthcare/ChatComponent/index1.vue'),
              meta: {
                title: '健康医疗/在线问诊',
                affix: true,
                noCache: true,
              },
            },
            {
              path: "/CommunityHealthcare/mcpcontent",
              name: 'mcpcontent',
              component: () => import('@/views/CommunityHealthcare/mcpcontent/index.vue'),
              meta: {
                title: '健康医疗/智能问答',
                affix: true,
                noCache: true,
              },
            },
            {
              path: "/CommunityHealthcare/uploadFunction",
              name: 'uploadFunction',
              component: () => import('@/views/CommunityHealthcare/uploadFunction/index.vue'),
              meta: {
                title: '健康医疗/病历上传工具',
                affix: true,
                noCache: true,
              },
            },
          ]
        },
        {
          path: '/LifeCircle',
          name: 'LifeCircle',
          component: () => import('../views/LifeCircle/index.vue'),
          meta: {
            title: '生活圈',
          },
        },
        {
          path: '/PlatformMall',
          name: 'PlatformMall',
          component: () => import('../views/PlatformMall/index.vue'),
          meta: {
            title: '平台商城',
          },
        },
        {
          path: '/product/:id',  // 动态路由，通过商品ID匹配
          name: 'ProductDetail',
          component: () => import('../views/ProductDetails/index.vue'),
          props: true,  // 允许将路由参数作为props传递给组件
          meta: {
            title: '商品购买界面',
          },
        },
        {
          path: '/product/:productId/reviews',
          name: 'ReviewDetail',
          component: () => import('@/views/ReviewDetail/index.vue'),
          meta: {
            title: '商品评价页面',
          },

        },
        {
          path: '/checkout',
          name: 'Checkout',
          component: () => import('@/views/Checkout/index.vue'),  // 商品下订单页面 :productId/:spec/:quantity/:addressId/:price'
        },
        {
          path: '/cart',
          name: 'Cart',
          component: () => import('@/views/CartPage/index.vue'),  // 商品购物车页面
        },
        {
          path: '/payment',
          name: 'Payment',
          component: () => import('@/views/ShopPayment/index.vue'),   // 支付页面路由配置

        },
        {
          path: '/shopmine',
          name: 'Shopmine',
          component: () => import('@/views/Shopmine/index.vue'),   // 支付页面路由配置

        },
        {
          path: '/order-list',
          name: 'OrderList',
          component: () => import('@/components/OrderList/index.vue'),   // 支付页面路由配置
        },
        {
          path: '/DiningCanteens',
          name: 'DiningCanteens',
          // route level code-splitting
          // this generates a separate chunk (About.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('../views/DiningCanteens/index.vue'),
          meta: {
            title: '餐饮食堂',
          },
        },
        {
          path: '/info',
          name: 'info',
          meta: {
            title: '个人订单页面',
          },
          component: () => import('../views/DiningCanteens/info.vue'),
        },
        {
          path: '/checkInOption',
          name: 'checkInOption',
          // route level code-splitting
          // this generates a separate chunk (About.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('../views/checkInOption/index.vue'),

          meta: {
            title: '智慧社区',
          },
        },
        {
          path: '/CommunityDetail/:comId',
          name: 'CommunityDetail',
          props: true,
          component: () => import('../views/CommunityDetailPage/index.vue'),
          meta: {
            title: '社区详情',
          },
        },
        {
          path: '/RouteDetails/:comId',
          name: 'RouteDetails',
          props: true,
          component: () => import('../views/RouteDetailsPage/index.vue'),
          meta: {
            title: '路线详情',
          },
        },
        {
          path: '/table',
          name: 'table',
          // route level code-splitting
          // this generates a separate chunk (About.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('../views/Table/index.vue'),
          meta: {
            title: '表格',
          },
        },
        {
          path: '/doubleTable',
          name: 'doubleTable',
          // route level code-splitting
          // this generates a separate chunk (About.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('../views/DoubleTable/index.vue'),
          meta: {
            title: '二级表格',
          },
        }
      ]
    },

    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login/Login.vue')
    },
    {
      path: '/Registered',
      name: 'Registered',
      component: () => import('../views/Registered/Registered.vue')
    },
    {
      path: '/ai-chat',
      name: 'ai-chat',
      component: () => import('../views/DiningCanteens/ai-chat.vue')

    },
    {
      path: '/LifePerson',
      name: 'LifePerson',
      component: () => import('../views/LifeCircle/person.vue')
    },
    {
      path: '/UpdateLifePerson',
      name: 'UpdateLifePerson',
      component: () => import('../views/LifeCircle/update.vue')
    },
    {
      path: '/UploadNotes',
      name: 'UploadNotes',
      component: () => import('../views/LifeCircle/note.vue')
    },
    {
      path: '/LifeChat',
      name: 'LifeChat',
      component: () => import('../views/LifeCircle/chat.vue')
    }

  ]
})

export default router
